import Vue from 'vue'
import VueRouter from 'vue-router' //引用他是要定义路由规则，规则就是某个url，显示哪个组件
import Index from '@/views/index.vue'
Vue.use(VueRouter); //vue支持路由，安装插件，注意这时候还没有路由器尼
const routes = [
        // { path: '/foo', component: Foo },
        // { path: '/bar', component: Bar }
        {
            path: '/',
            component: Index //同步加载组件方式
        },
        {
            path: "/test",
            component: () => {
                return import (
                    /*webpackChunkName:"test"*/
                    '../views/Test.vue'
                )
            }
        }
    ]
    //声明路由器

const router = new VueRouter({
    routes
})
export default router //把路由模块导出